<template>
	<van-popup custom-style="background: #f3f3f3" :show="isShow" position="bottom" round @click-overlay="$emit('getClose')">
		<view class="p_font_28 p_flex7 p_margin_tb_48">选择抬头</view>
		<view class="modal_main">
			<view class="r_list p_flex2" v-for="item in listData" :key="item.id" @click="$emit('getLookUp', item)">
				<view class="p_font_32 p_flex_1 p_one_text">{{item.name}}</view>
				<image src="https://dy.sykj365.com/uploads/mini/bianji@2x.png" class="p_img_32 p_margin_l_30" @click.stop="getLink(item)">
				</image>
			</view>
		</view>
		<view class="p_bg_fff p_over">
			<navigator url="/pages/my/addRise" hover-class="none" class="p_btn">
				<view>添加新抬头</view>
			</navigator>
		</view>
	</van-popup>
</template>

<script>
	export default {
		props: {
			isShow: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				listData: [],
			}
		},
		created() {
			this.getListData();
		},
		methods: {
			getListData(id) {
				this.$http.post(this.$api.lookUp).then(res => {
					this.listData = res.data;
					
					if(id) {
						this.listData.forEach((n) => {
							if(n.id == id) {
								this.$emit('getLookUp', n)
							}
						})
					}
				})
			},
			getLink(item) {
				getApp().getNavigateTo('/pages/my/addRise?id=' + item.id)
			}
		}
	}
</script>

<style lang="less">
	.modal_main {
		height: 672rpx;
		overflow-y: auto;
	}

	.r_list {
		margin: 0 32rpx 16rpx;
		padding: 32rpx;
		border-radius: 16rpx;
		background-color: #fff;
	}
</style>
